<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/30
 * Time: 20:00
 */

namespace app\modules\api\models;


use app\models\LiveIndex;

class LiveTimeForm extends Model
{
    public $wechat_app_id;

    public function rules()
    {
        return [
            [['wechat_app_id',], 'required',],
        ];
    }

    public function search()
    {
        if(!$this->validate()){
            return $this->getModelError();
        }

        $query = LiveIndex::find()->where(['wechat_app_id'=>$this->wechat_app_id,'is_delete'=>0]);


        $list = $query->one();
        return [
            'start'=>$list['begin_time'],
            'end'=>$list['end_time'],
            'state'=>$list['status'],
        ];
    }
}